home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gtlayout / source / gtlayout_internal.h < prev    next >
C/C++ Source or Header  |  1999-04-19  |  23KB  |  1,077 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1998 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=8
  8. */
  9.  
  10. #ifndef _GTLAYOUT_INTERNAL_H
  11. #define _GTLAYOUT_INTERNAL_H 1
  12.  
  13.     // Debugging stuff
  14.  
  15. #ifdef DEBUG
  16. #define DB(x)    x
  17. #else
  18. #define DB(x)    ;
  19. #endif    /* DEBUG */
  20.  
  21.     // Keep this one handy
  22.  
  23. VOID kprintf(STRPTR,...);
  24.  
  25. /*****************************************************************************/
  26.  
  27.  
  28.     // Keyboard qualifiers
  29.  
  30. #define QUALIFIER_SHIFT     (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)
  31. #define QUALIFIER_ALT        (IEQUALIFIER_LALT | IEQUALIFIER_RALT)
  32. #define QUALIFIER_CONTROL    (IEQUALIFIER_CONTROL)
  33.  
  34.  
  35. /*****************************************************************************/
  36.  
  37.  
  38.     // Undefine these to remove various chunks of support from this code
  39.  
  40. #ifdef _GTLAYOUT_GLOBAL_H
  41. #define DO_PASSWORD_KIND
  42. #define DO_GAUGE_KIND
  43. #define DO_TAPEDECK_KIND
  44. #define DO_HEXHOOK
  45. #define DO_PICKSHORTCUTS
  46. #define DO_CLONING
  47. #define DO_LEVEL_KIND
  48. #define DO_BOOPSI_KIND
  49. #define DO_MENUS
  50. #define DO_POPUP_KIND
  51. #define DO_TAB_KIND
  52. #else
  53. #define DO_PASSWORD_KIND
  54. #define DO_GAUGE_KIND
  55. #define DO_CLONING
  56. #define DO_BOOPSI_KIND
  57. #define DO_POPUP_KIND
  58. #endif    // _GTLAYOUT_GLOBAL_H
  59.  
  60.     // These types require that the BOOPSI_KIND support
  61.     // code is included.
  62.  
  63. #if defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND)
  64. #define DO_BOOPSI_KIND
  65. #endif    /* defined(DO_LEVEL_KIND) || defined(DO_POPUP_KIND) || defined(DO_TAB_KIND) */
  66.  
  67. /*****************************************************************************/
  68.  
  69.  
  70. APTR ASM AsmCreatePool(REG(d0) ULONG MemFlags,REG(d1) ULONG PuddleSize,REG(d2) ULONG ThreshSize,REG(a6) struct Library *SysBase);
  71. VOID ASM AsmDeletePool(REG(a0) APTR PoolHeader,REG(a6) struct Library *SysBase);
  72. APTR ASM AsmAllocPooled(REG(a0) APTR PoolHeader,REG(d0) ULONG Size,REG(a6) struct Library *SysBase);
  73. VOID ASM AsmFreePooled(REG(a0) APTR PoolHeader,REG(a1) APTR Memory,REG(d0) ULONG MemSize,REG(a6) struct Library *SysBase);
  74.  
  75.  
  76. /*****************************************************************************/
  77.  
  78.  
  79.     // Scan an Exec list
  80.  
  81. #define SCANLIST(l,n)    for(n = (APTR)((struct MinList *)l)->mlh_Head; \
  82.             ((struct MinNode *)n)->mln_Succ; \
  83.             n = (APTR)((struct MinNode *)n)->mln_Succ)
  84.  
  85.     // Scan the objects of a group
  86.  
  87. #define SCANGROUP(g,n)    for(n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
  88.             ((struct MinNode *)n)->mln_Succ; \
  89.             n = (APTR)((struct MinNode *)n)->mln_Succ)
  90.  
  91.     // Scan the objects of a group, only allowing active pages
  92.  
  93. #define SCANPAGE(g,n,p) for(p = 0, n = (APTR)g->Special . Group . ObjectList . mlh_Head; \
  94.             ((struct MinNode *)n)->mln_Succ; \
  95.             n = (APTR)((struct MinNode *)n)->mln_Succ) \
  96.             if ((p++ == g->Special . Group . ActivePage) || !g->Special . Group . Paging)
  97.  
  98.     // Get an object pointer from a gadget pointer
  99.  
  100. #define GETOBJECT(g,n)    ((n = (ObjectNode *)g->UserData) && (n->Host == g) && (n->PointBack == n))
  101.  
  102.  
  103. /*****************************************************************************/
  104.  
  105.  
  106. #ifdef DO_PASSWORD_KIND
  107. #define TEST_PASSWORD_KIND(n) (n->Type == PASSWORD_KIND)
  108. #else
  109. #define TEST_PASSWORD_KIND(n) (FALSE)
  110. #endif    /* DO_PASSWORD_KIND */
  111.  
  112.     // Is an object derived from STRING_KIND?
  113.  
  114. #define LIKE_STRING_KIND(n) (n->Type == STRING_KIND || n->Type == FRACTION_KIND || TEST_PASSWORD_KIND(n))
  115.  
  116.  
  117. /*****************************************************************************/
  118.  
  119.  
  120. #define NUMELEMENTS(s) (sizeof(s) / sizeof((s)[0]))
  121.  
  122. #define NOT !
  123. #define CANNOT !
  124.  
  125.  
  126. /*****************************************************************************/
  127.  
  128.  
  129. typedef char BOOLEAN;
  130.  
  131.  
  132. /*****************************************************************************/
  133.  
  134.  
  135. #define INCREMENTER_KIND    42
  136. #define PICKER_KIND        43
  137. #define GROUP_KIND        44
  138.  
  139. #define LAPR_Gadget        TAG_USER+100
  140. #define LAPR_Object        TAG_USER+101
  141.  
  142. typedef struct GaugeExtra
  143. {
  144.     LONG            InfoLength;
  145.     STRPTR            InfoText;
  146.     WORD            LastPercentage;
  147.     BOOLEAN            NoTicks;
  148.     BOOLEAN            Discrete;
  149. } GaugeExtra;
  150.  
  151. typedef struct TapeDeckExtra
  152. {
  153.     struct Image *        ButtonImage;
  154.     LONG            ButtonWidth,
  155.                 ButtonHeight;
  156.     BOOLEAN         ButtonType;
  157.     BOOLEAN            Toggle;
  158.     BOOLEAN            Smaller;
  159.     BOOLEAN            Tick;
  160. } TapeDeckExtra;
  161.  
  162. typedef struct ButtonExtra
  163. {
  164.     struct Image *        ButtonImage;
  165.     STRPTR            KeyStroke;
  166.     STRPTR *        Lines;
  167.     UBYTE            LineCount;
  168.  
  169.     BOOLEAN         ReturnKey;
  170.     BOOLEAN         EscKey;
  171.     BOOLEAN         ExtraFat;
  172.     BOOLEAN            DefaultCorrection;
  173.     BOOLEAN            Smaller;
  174. } ButtonExtra;
  175.  
  176. typedef struct BarExtra
  177. {
  178.     struct ObjectNode *    Parent;
  179.     BOOLEAN         FullSize;
  180. } BarExtra;
  181.  
  182. typedef struct BoxExtra
  183. {
  184.     struct ObjectNode *    Parent;
  185.     STRPTR *        Labels;
  186.     STRPTR *        Lines;
  187.     UWORD            Spacing;
  188.     WORD            MaxSize;
  189.     WORD            TextPen;
  190.     WORD            BackPen;
  191.     BYTE            AlignText;
  192.     BOOLEAN         DrawBox;
  193.     BOOLEAN         ReserveSpace;
  194. } BoxExtra;
  195.  
  196. typedef struct FrameExtra
  197. {
  198.     struct Hook *        RefreshHook;
  199.     UWORD            InnerWidth;
  200.     UWORD            InnerHeight;
  201.     struct Gadget        Dummy;
  202.     WORD            PlusWidth;    // Is used by the resizing process
  203.     WORD            PlusHeight;    // to change the inner width
  204.     BOOLEAN         DrawBox;
  205.     BOOLEAN            GenerateEvents;
  206.     BOOLEAN            ResizeX;
  207.     BOOLEAN            ResizeY;
  208. } FrameExtra;
  209.  
  210. typedef struct PickerExtra
  211. {
  212.     struct Gadget *        Parent;        // Important: must match IncrementerExtra!
  213.     struct Image *        Image;        // Important: must match IncrementerExtra!
  214. } PickerExtra;
  215.  
  216. typedef struct IncrementerExtra
  217. {
  218.     struct Gadget *        Parent;        // Important: must match PickerExtra!
  219.     struct Image *        Image;        // Important: must match PickerExtra!
  220.     LONG            Amount;
  221. } IncrementerExtra;
  222.  
  223. typedef struct GroupExtra
  224. {
  225.     struct MinList        ObjectList;
  226.     struct ObjectNode *    ParentGroup;
  227.     LONG            MaxOffset;
  228.     LONG            MaxSize;
  229.     ULONG            ActivePage;
  230.     UWORD            ExtraLeft;
  231.     UWORD            ExtraTop;
  232.     UWORD            FrameType;
  233.     UBYTE            MiscFlags;
  234.     BOOLEAN         Horizontal;
  235.     BOOLEAN         Paging;
  236.     BOOLEAN         Spread;
  237.     BOOLEAN         SameSize;
  238.     BOOLEAN         LastAttributes;
  239.     BOOLEAN         Visible;
  240.     BOOLEAN            Frame;
  241.     BOOLEAN            IndentX;
  242.     BOOLEAN            IndentY;
  243.     BOOLEAN            NoIndent;
  244.     BOOLEAN            AlignRight;
  245. } GroupExtra;
  246.  
  247. #define GROUPF_WidthDone    (1<<0)
  248. #define GROUPF_HeightDone    (1<<1)
  249.  
  250. typedef struct ListExtra
  251. {
  252.     struct List *        Labels;
  253.     struct Gadget *        Link;
  254.     LONG            LinkID;
  255.     struct Hook *        CallBack;
  256.     LONG            AutoPageID;
  257.     struct TextAttr *    TextAttr;
  258.     STRPTR *        ExtraLabels;
  259.     UWORD            ExtraLabelWidth;
  260.     UWORD            MaxPen;
  261.     UWORD            MaxGrowX,MaxGrowY;
  262.     UWORD            MinChars,MinLines;
  263.     WORD            FixedGlyphWidth;
  264.     WORD            FixedGlyphHeight;
  265.     BOOLEAN         ReadOnly;
  266.     BOOLEAN         CursorKey;
  267.     BOOLEAN         AllocatedList;
  268.     BOOLEAN            LockSize;
  269.     BOOLEAN            SizeLocked;
  270.     BOOLEAN            ResizeX;
  271.     BOOLEAN            ResizeY;
  272.     BOOLEAN            FlushLabelLeft;
  273.     BOOLEAN            IgnoreListContents;
  274.     BOOLEAN            AdjustForString;
  275. } ListExtra;
  276.  
  277. typedef struct RadioExtra
  278. {
  279.     STRPTR *        Choices;
  280.     LONG            AutoPageID;
  281.     UWORD            LabelWidth;
  282.     UBYTE            TitlePlace;
  283.     BOOLEAN            TabKey;
  284. } RadioExtra;
  285.  
  286. typedef struct TextExtra
  287. {
  288.     STRPTR            Text;
  289.     struct Gadget *        Picker;
  290.     WORD            FrontPen;
  291.     WORD            BackPen;
  292.     UWORD            Len;
  293.     UBYTE            Justification;
  294.     BOOLEAN         Border;
  295.     BOOLEAN         CopyText;
  296.     BOOLEAN         UsePicker;
  297.     BOOLEAN            LockSize;
  298.     BOOLEAN            SizeLocked;
  299. } TextExtra;
  300.  
  301. typedef struct NumberExtra
  302. {
  303.     LONG            Number;
  304.     STRPTR            Format;
  305.     WORD            FrontPen;
  306.     WORD            BackPen;
  307.     WORD            MaxNumberLen;
  308.     UBYTE            Justification;
  309.     BOOLEAN         Border;
  310. } NumberExtra;
  311.  
  312. typedef struct CycleExtra
  313. {
  314.     STRPTR *        Choices;
  315.     LONG            AutoPageID;
  316.     BOOLEAN            TabKey;
  317. } CycleExtra;
  318.  
  319. typedef struct PalExtra
  320. {
  321.     UBYTE *            ColourTable;
  322.     UBYTE *            TranslateBack;
  323.     struct Gadget *        Picker;
  324.     UWORD            Depth;
  325.     UWORD            NumColours;
  326.     UWORD            IndicatorWidth;
  327.     BOOLEAN         SmallPalette;
  328.     BOOLEAN            UsePicker;
  329. } PalExtra;
  330.  
  331. typedef struct SliderExtra
  332. {
  333.     STRPTR            LevelFormat;
  334.     DISPFUNC        DispFunc;
  335.     LONG            MaxLevelLen;
  336.     LONG            LevelWidth;
  337.     STRPTR            OriginalLabel;
  338.     UBYTE            LevelPlace;
  339.     BOOLEAN         FullLevelCheck;
  340. } SliderExtra;
  341.  
  342. typedef struct StringExtra
  343. {
  344.     struct LayoutHandle *    LayoutHandle;
  345.     struct Hook *        HistoryHook;
  346.     ULONG            MaxHistoryLines;
  347.     ULONG            NumHistoryLines;
  348.     struct Node *        CurrentNode;
  349.  
  350.     STRPTR            String;
  351.     LONG            MaxChars;
  352.     struct Hook *        EditHook;
  353.     struct Hook *        ValidateHook;
  354.     struct Gadget *        Picker;
  355.     STRPTR            Backup;
  356.     STRPTR            RealString;
  357.     STRPTR            Original;
  358.     LONG            LinkID;
  359.  
  360.     struct Gadget *        LeftIncrementer;
  361.     struct Gadget *        RightIncrementer;
  362.  
  363.     struct Hook *        IncrementerHook;
  364.  
  365.     UBYTE            Justification;
  366.     BOOLEAN         LastGadget;
  367.     BOOLEAN         UsePicker;
  368.     BOOLEAN            Activate;
  369. } StringExtra;
  370.  
  371. typedef struct IntegerExtra
  372. {
  373.     struct LayoutHandle *    LayoutHandle;
  374.     struct Hook *        HistoryHook;
  375.     ULONG            MaxHistoryLines;
  376.     ULONG            NumHistoryLines;
  377.     struct Node *        CurrentNode;
  378.  
  379.     struct Gadget *        LeftIncrementer;
  380.     struct Gadget *        RightIncrementer;
  381.  
  382.     struct Hook *        IncrementerHook;
  383.  
  384.     LONG            Number;
  385.     LONG            MaxChars;
  386.     struct Hook *        EditHook;
  387.     struct Hook *        ValidateHook;
  388.  
  389.     UBYTE            Justification;
  390.     BOOLEAN         LastGadget;
  391.     BOOLEAN         UseIncrementers;
  392.     BOOLEAN            CustomHook;
  393.     BOOLEAN            Activate;
  394. } IntegerExtra;
  395.  
  396. typedef struct ScrollerExtra
  397. {
  398.     struct ObjectNode *    Parent;
  399.     WORD            Visible;
  400.     WORD            ArrowSize;
  401.     BOOLEAN         RelVerify;
  402.     BOOLEAN            Immediate;
  403.     BOOLEAN            Arrows;
  404.     BOOLEAN            Vertical;
  405.     BOOLEAN            Thin;
  406.     BOOLEAN            FullSize;
  407. } ScrollerExtra;
  408.  
  409. typedef struct LevelExtra
  410. {
  411.     WORD            Freedom;
  412.     WORD            Ticks;
  413.     WORD            NumTicks;
  414.     LONG            Plus;
  415.     STRPTR            LevelFormat;
  416.     DISPFUNC        DispFunc;
  417.     LONG            MaxLevelWidth;
  418.     LONG            LevelPlace;
  419.     BOOLEAN            FullLevelCheck;
  420. } LevelExtra;
  421.  
  422. typedef struct BOOPSIExtra
  423. {
  424.     struct Library *    ClassBase;
  425.     Class *            ClassInstance;
  426.     STRPTR            ClassName;
  427.     STRPTR            ClassLibraryName;
  428.     struct TagItem *    ClassTags;
  429.     ULONG            TagCurrent,
  430.                 TagTextAttr,
  431.                 TagDrawInfo,
  432.                 TagLink,
  433.                 TagScreen;
  434.     LONG            Link;
  435.     struct ObjectNode *    Parent;
  436.     struct Hook *        ActivateHook;
  437.     WORD            ExactWidth,
  438.                 ExactHeight;
  439.     WORD            RelFontHeight;
  440.     BOOLEAN            FullWidth;
  441.     BOOLEAN            FullHeight;
  442. } BOOPSIExtra;
  443.  
  444. typedef struct PopupExtra
  445. {
  446.     STRPTR *        Choices;
  447.     LONG            AutoPageID;
  448.     BOOLEAN            TabKey;
  449.     BOOLEAN            CentreActive;
  450. } PopupExtra;
  451.  
  452. typedef struct TabExtra
  453. {
  454.     STRPTR *        Choices;
  455.     LONG            AutoPageID;
  456.     struct ObjectNode *    Parent;
  457.     BOOLEAN            TabKey;
  458.     BOOLEAN            FullWidth;
  459.     BOOLEAN            FrameGroup;
  460. } TabExtra;
  461.  
  462. typedef struct ImageExtra
  463. {
  464.     struct Image *        Image;
  465.     struct BitMap *        BitMap;
  466.     PLANEPTR        BitMapMask;
  467.     UWORD            BitMapLeft;
  468.     UWORD            BitMapTop;
  469.     UWORD            BitMapWidth;
  470.     UWORD            BitMapHeight;
  471. } ImageExtra;
  472.  
  473. typedef struct ObjectNode
  474. {
  475.     struct MinNode        Node;
  476.     struct Gadget *        Host;
  477.     struct ObjectNode *    PointBack;
  478.     STRPTR            Label;
  479.     LONG            ID;
  480.     LONG            Min;
  481.     LONG            Max;
  482.     LONG            Current;
  483.     APTR            Storage;
  484.  
  485.     UWORD            Left;
  486.     UWORD            Top;
  487.     UWORD            Width;
  488.     UWORD            Height;
  489.     UWORD            LabelWidth;
  490.     UWORD            Lines;
  491.     UWORD            Chars;
  492.     UWORD            LayoutSpace;
  493.     WORD            ExtraSpace;
  494.     WORD            LabelChars;
  495.  
  496.     UBYTE            Type;
  497.     BYTE            LabelPlace;
  498.     UBYTE            Key;
  499.     UBYTE            StorageType;
  500.     BOOLEAN            DefaultSize;
  501.     BOOLEAN         Disabled;
  502.     BOOLEAN         NoKey;
  503.     BOOLEAN         HighLabel;
  504.     BOOLEAN         GroupIndent;
  505.     BOOLEAN         PageSelector;
  506.  
  507.     union
  508.     {
  509.         GaugeExtra        Gauge;
  510.         TapeDeckExtra        TapeDeck;
  511.         ButtonExtra        Button;
  512.         BarExtra        Bar;
  513.         BoxExtra        Box;
  514.         FrameExtra        Frame;
  515.         PickerExtra        Picker;
  516.         IncrementerExtra    Incrementer;
  517.         GroupExtra        Group;
  518.         ListExtra        List;
  519.         RadioExtra        Radio;
  520.         TextExtra        Text;
  521.         NumberExtra        Number;
  522.         CycleExtra        Cycle;
  523.         PalExtra        Palette;
  524.         SliderExtra        Slider;
  525.         StringExtra        String;
  526.         IntegerExtra        Integer;
  527.         ScrollerExtra        Scroller;
  528.         LevelExtra        Level;
  529.         BOOPSIExtra        BOOPSI;
  530.         PopupExtra        Popup;
  531.         TabExtra        Tab;
  532.         ImageExtra        Image;
  533.     } Special;
  534. } ObjectNode;
  535.  
  536. typedef struct LayoutHandle
  537. {
  538.         // WARNING: Beginning of this structure must match the definition in gtlayout.h!
  539.  
  540.     struct Screen *        Screen;
  541.     struct DrawInfo *    DrawInfo;
  542.     struct Window *        Window;
  543.     APTR            VisualInfo;
  544.     struct Image *        AmigaGlyph;
  545.     struct Image *        CheckGlyph;
  546.     APTR            UserData;
  547.     struct Menu *        Menu;
  548.  
  549.         // End of public part
  550.  
  551.     struct Screen *        PubScreen;
  552.     struct MsgPort *    MsgPort;
  553.     struct Gadget **    GadgetArray;
  554.     struct Gadget *        Previous;
  555.     struct Gadget *        List;
  556.     struct Image *        BevelImage;
  557.     struct Image *        GrooveImage;
  558.     APTR            WindowUserData;
  559.     ULONG            IDCMP;
  560.     ULONG            WA_ScreenTag;
  561.     BOOL            UnlockPubScreen;
  562.     BOOL            UseGroove;
  563.  
  564.         // BOOPSI support
  565.  
  566.     Object *        BOOPSIPrevious;
  567.     Object *        BOOPSIList;
  568.  
  569.         // Incrementers
  570.  
  571.     ObjectNode *        ActiveIncrementer;
  572.     WORD            IncrementerCountdown;
  573.     WORD            IncrementerAccelerate;
  574.     LONG            IncrementerIncrement;
  575.  
  576.         // Frames
  577.  
  578.     ObjectNode *        ActiveFrame;
  579.  
  580.         // Cached from DrawInfo structure
  581.  
  582.     UWORD            TextPen;
  583.     UWORD            BackgroundPen;
  584.     UWORD            ShadowPen;
  585.     UWORD            ShinePen;
  586.  
  587.     UWORD            AspectX;
  588.     UWORD            AspectY;
  589.  
  590.         // Double-click support
  591.  
  592.     ULONG            ClickSeconds;
  593.     ULONG            ClickMicros;
  594.     ObjectNode *        ClickObject;
  595.  
  596.     struct Hook *        LocaleHook;
  597.     struct TextAttr *    TextAttr;
  598.     struct TextAttr *    InitialTextAttr;
  599.     struct TTextAttr    CopyTextAttr;
  600.     struct RastPort     RPort;
  601.  
  602.     APTR            Pool;
  603.  
  604.     UWORD            GlyphWidth;
  605.     UWORD            GlyphHeight;
  606.  
  607.     UWORD            InterWidth;
  608.     UWORD            InterHeight;
  609.  
  610.     LONG            Count;
  611.  
  612.     LONG            Index;
  613.  
  614.     ObjectNode *        TopGroup;
  615.     ObjectNode *        CurrentGroup;
  616.     ObjectNode *        EscKey;
  617.     ObjectNode *        ReturnKey;
  618.     ObjectNode *        CursorKey;
  619.     ObjectNode *        GrowView;
  620.     ObjectNode *        ResizeObject;
  621.     ObjectNode *        TabKey;
  622.     ObjectNode *        ActiveString;
  623. #ifdef DO_PASSWORD_KIND
  624.     struct Hook        PasswordEditHook;
  625. #endif
  626. #ifdef DO_HEXHOOK
  627.     struct Hook        HexEditHook;
  628. #endif    /* DO_HEXHOOK */
  629.     struct Hook        DefaultEditHook;
  630.     struct Hook *        StandardEditHook;
  631.  
  632.     struct Hook        BackfillHook;
  633.     struct RastPort        BackfillRastPort;
  634.  
  635. #ifdef DO_LEVEL_KIND
  636.     ObjectNode *        CurrentLevel;
  637. #endif    /* DO_LEVEL_KIND */
  638.  
  639.     struct TTextAttr    FixedFont;
  640.  
  641.     struct LayoutHandle *    PointBack;
  642.  
  643.     LONG            GroupID;
  644.  
  645. #ifdef DO_PICKSHORTCUTS
  646.     UBYTE            Keys[256];
  647. #endif    /* DO_PICKSHORTCUTS */
  648.  
  649.     struct Window *        Parent;        // Parent of this window
  650.     struct Hook *        HelpHook;        // Hook to call when help key is pressed
  651.     LONG            MaxPen;
  652.  
  653.     WORD            SizeWidth;
  654.     WORD            SizeHeight;
  655.  
  656.     BOOLEAN            SizeVerified;
  657.     BOOLEAN         AutoRefresh;
  658.     BOOLEAN         CloseFont;
  659.     BOOLEAN         Failed;
  660.     BOOLEAN         Rescaled;
  661.     BOOLEAN         AutoActivate;
  662.     BOOLEAN         MoveToWindow;
  663.     BOOLEAN            NeedDelay;
  664.     BOOLEAN            RawKeyFilter;
  665.     BOOLEAN            FlushLeft;
  666.     BOOLEAN            FlushTop;
  667.     BOOLEAN            BlockParent;
  668.     BOOLEAN            ExitFlush;
  669.     BOOLEAN            NoKeys;
  670.  
  671. #ifdef DO_CLONING
  672.     struct CloneExtra *    CloneExtra;        // Screen cloning information
  673.     STRPTR            CloneScreenTitle;    // Title of the cloned screen, if any
  674.     BOOLEAN         CloningPermitted;    // Genetic engineering?
  675.     BOOLEAN         ExactClone;        // Make an exact copy, i.e. preserve all colours
  676.     BOOLEAN            SimpleClone;        // Just a simple clone, please
  677.     BYTE            Pad0;
  678. #endif
  679.  
  680.     BOOLEAN            CloseTopGroup;        // Close the top group at LT_Build() time
  681. } LayoutHandle;
  682.  
  683. #define PHANTOM_GROUP_ID    -10000    // Phantom groups, i.e those without proper
  684.                     // IDs start with this ID
  685.  
  686. /*****************************************************************************/
  687.  
  688.  
  689.     // Window locking
  690.  
  691. typedef struct LockNode
  692. {
  693.     struct MinNode        MinNode;
  694.     struct Window *        Window;
  695.     LONG            Count;
  696.     ULONG            OldIDCMPFlags;
  697.     struct Requester    Requester;
  698.     LONG            MinWidth;
  699.     LONG            MinHeight;
  700.     LONG            MaxWidth;
  701.     LONG            MaxHeight;
  702. } LockNode;
  703.  
  704.  
  705. /*****************************************************************************/
  706.  
  707.  
  708.     // Image class extension
  709.  
  710. typedef struct ImageInfo
  711. {
  712.     STRPTR *        Lines;        // Text lines
  713.     STRPTR            KeyStroke;    // Points to char that acts as keystroke identifier
  714.  
  715.     STRPTR            Label;        // Single label if any
  716.  
  717.     struct TextFont *    Font;        // Open font if any
  718.     struct Image *        FrameImage;    // Button frame imagery, if any
  719.  
  720.     UWORD            ImageType;    // Type
  721.  
  722.     UWORD            GlyphWidth;    // Size
  723.     UWORD            GlyphHeight;
  724.  
  725.     UWORD            LineCount;    // Number of lines below
  726.  
  727.     BOOLEAN            Emboss;    // Emboss the bevel box
  728.     BOOLEAN            UseFrame;    // Always use the frame image?
  729. } ImageInfo;
  730.  
  731.     // Image class extension types
  732.  
  733. #define IIA_ImageType    (TAG_USER+739)
  734. #define IIA_GlyphWidth    (TAG_USER+740)
  735. #define IIA_GlyphHeight    (TAG_USER+741)
  736. #define IIA_Lines    (TAG_USER+742)
  737. #define IIA_LineCount    (TAG_USER+743)
  738. #define IIA_KeyStroke    (TAG_USER+744)
  739. #define IIA_Emboss    (TAG_USER+745)
  740. #define IIA_Label    (TAG_USER+746)
  741. #define IIA_Font    (TAG_USER+747)
  742.  
  743.     // Supported image class extension types
  744.  
  745. enum
  746. {
  747.     IMAGECLASS_PICKER,
  748.     IMAGECLASS_LEFTINCREMENTER,
  749.     IMAGECLASS_RIGHTINCREMENTER,
  750.     IMAGECLASS_BACKWARD,
  751.     IMAGECLASS_FORWARD,
  752.     IMAGECLASS_PREVIOUS,
  753.     IMAGECLASS_NEXT,
  754.     IMAGECLASS_RECORD,
  755.     IMAGECLASS_PLAY,
  756.     IMAGECLASS_STOP,
  757.     IMAGECLASS_PAUSE,
  758.     IMAGECLASS_REWIND,
  759.     IMAGECLASS_EJECT,
  760.     IMAGECLASS_MULTILINEBUTTON
  761. };
  762.  
  763.  
  764. /*****************************************************************************/
  765.  
  766.  
  767. struct SliderClassData
  768. {
  769.     BOOL            IsVertical;
  770.     WORD            UseTicks;
  771.  
  772.     UWORD            Width;
  773.     UWORD            Height;
  774.  
  775.     UWORD            SeparatorSpace;
  776.     UWORD            TickSpace;
  777.  
  778.     UWORD            TickTop;
  779.     UWORD            RailTop;
  780.     UWORD            ThumbTop;
  781.  
  782.     UWORD            ThumbWidth;
  783.     UWORD            ThumbHeight;
  784.  
  785.     UWORD            ThumbLeft;
  786.     UWORD            ThumbLast;
  787.     ULONG            ThumbPosition;
  788.     ULONG            ThumbMax;
  789.     ULONG            NumTicks;
  790.  
  791.     struct DrawInfo *    DrawInfo;
  792.  
  793.     struct BitMap        ThumbBitMap;
  794.  
  795.     LONG            ActiveOffset;
  796.     BOOL            DirectHit;
  797. };
  798.  
  799. #define    SLA_Dummy     (TAG_USER+0x700000)
  800.  
  801. #define SLA_DrawInfo    (SLA_Dummy+1)
  802. #define SLA_Current    (SLA_Dummy+2)
  803. #define SLA_Max        (SLA_Dummy+3)
  804. #define SLA_Position    (SLA_Dummy+4)
  805. #define SLA_NumTicks    (SLA_Dummy+5)
  806. #define SLA_UseTicks    (SLA_Dummy+6)
  807. #define SLA_Reference    (SLA_Dummy+7)
  808.  
  809.  
  810. /*****************************************************************************/
  811.  
  812.  
  813. enum
  814. {
  815.     STORAGE_BYTE,STORAGE_UBYTE,
  816.     STORAGE_WORD,STORAGE_UWORD,
  817.     STORAGE_LONG,STORAGE_ULONG,
  818.     STORAGE_STRPTR
  819. };
  820.  
  821.  
  822. /*****************************************************************************/
  823.  
  824.  
  825.     // A single colour in 96 bit precision
  826.  
  827. struct ColourTriplet
  828. {
  829.     ULONG Red;        // 32 bits each
  830.     ULONG Green;
  831.     ULONG Blue;
  832. };
  833.  
  834.     // A colour table ready to submit to LoadRGB32
  835.  
  836. struct ColourRecord
  837. {
  838.     UWORD            NumColours;    // Number of colours in this chunk
  839.     UWORD            FirstColour;    // First colour entry to set
  840.  
  841.     struct ColourTriplet    Triplets[0];    // Table entries
  842.  
  843.     WORD            Arnold;     // Array terminator, needs to be set to zero
  844. };
  845.  
  846.     // Screen reproduction
  847.  
  848. struct CloneExtra
  849. {
  850.     struct Screen *    Screen;
  851.     LONG *        Pens;
  852.     UWORD *        ScreenPens;
  853.     UWORD        MinWidth,
  854.             MinHeight,
  855.             MaxWidth,
  856.             MaxHeight,
  857.             TotalPens;
  858.     UBYTE        Depth;
  859.     struct IBox    Bounds;
  860. };
  861.  
  862.  
  863. /*****************************************************************************/
  864.  
  865.  
  866. #define ITEMF_HasSub    (1 << 0)        // Next item is a subitem
  867. #define ITEMF_FirstSub    (1 << 1)        // This is the first subitem
  868. #define ITEMF_IsSub    (1 << 2)        // This is a subitem
  869. #define ITEMF_LastItem    (1 << 3)        // This is the last item
  870. #define ITEMF_IsBar    (1 << 4)        // This is a separator bar
  871. #define ITEMF_Command    (1 << 5)        // This item has a long command key sequence
  872.  
  873. typedef struct ItemNode
  874. {
  875.     struct MinNode     Node;
  876.     struct MenuItem     Item;
  877.     APTR         UserData;
  878.     ULONG         ID;            // Item ID
  879.  
  880.     STRPTR         ExtraLabel;        // For long command sequence labels
  881.     UWORD         Flags;            // Flag bits as defined above
  882.     WORD         Left,            // Actual left edge
  883.              Top;            // Actual top edge
  884.     WORD         Width;            // Actual width
  885.  
  886.     UWORD         MenuCode;        // Intuition menu code
  887.  
  888.     ULONG         Qualifier;        // Message qualifier
  889.     UWORD         Code;            // Message code
  890.     UBYTE         Char;            // ASCII code
  891. } ItemNode, *pItemNode;
  892.  
  893. typedef struct MenuNode
  894. {
  895.     struct MinNode     Node;
  896.     struct Menu     Menu;
  897.     APTR         UserData;
  898.     ULONG         ID;            // Item ID
  899.  
  900.     WORD         Width;            // Actual width
  901.  
  902.     UWORD         MenuCode;        // Intuition menu code
  903. } MenuNode, *pMenuNode;
  904.  
  905. typedef struct RootMenu
  906. {
  907.     APTR            Pool;        // Memory allocation
  908.     struct TextFont *    Font;        // Preferred item font
  909.     struct TextAttr *    TextAttr;    // What goes into the single items
  910.     struct TTextAttr    BoldAttr;    // Same as above, just in boldface
  911.     struct DrawInfo *    DrawInfo;    // Screen drawing info
  912.     struct Screen *        Screen;        // The screen we are building the menu for
  913.     struct RastPort        RPort;        // Dummy RastPort for font measuring
  914.  
  915.     WORD            ItemHeight;    // Default item height
  916.     UWORD            TextPen;    // Text rendering pen
  917.  
  918.     ULONG            CheckWidth,    // Size of the checkmark glyph
  919.                 CheckHeight,
  920.                 AmigaWidth,    // Size of the Amiga glyph
  921.                 AmigaHeight;
  922.  
  923.     struct MinList        MenuList;    // List of menus
  924.     struct MinList        ItemList;    // List of menu items
  925.  
  926.     LayoutHandle *        Handle;        // Layout handle if any
  927.     struct Hook *        LocaleHook;    // Localization, if no handle is provided
  928.  
  929.     struct MinNode        Node;        // The initial menu all the data is tied to
  930.     struct Menu        Menu;
  931.     APTR            UserData;
  932.     ULONG            ID;
  933.     WORD            Width;
  934.     UWORD            MenuCode;
  935. } RootMenu, *pRootMenu;
  936.  
  937.  
  938. /*****************************************************************************/
  939.  
  940.  
  941. typedef struct PopInfo
  942. {
  943.     struct CheckGlyph *    CheckGlyph;
  944.  
  945.     LONG            MaxLen;
  946.     LONG            MaxWidth;
  947.  
  948.     struct Window *        Window;
  949.     struct TextFont    *    Font;
  950.  
  951.     LONG            TopMost;
  952.  
  953.     LONG            LastDrawn;
  954.     LONG            LastLabelDrawn;
  955.  
  956.     struct Image *        FrameImage;
  957.  
  958.     STRPTR *        Labels;
  959.     LONG            NumLabels;
  960.     LONG            Active;
  961.     LONG            InitialActive;
  962.     UWORD            ActiveLen;
  963.  
  964.     UWORD            MarkLeft;
  965.     UWORD            MarkWidth;
  966.  
  967.     UWORD            LabelLeft;
  968.     UWORD            LabelTop;
  969.  
  970.     UWORD            LineTop;
  971.  
  972.     UWORD            ArrowTop;
  973.     UWORD            ArrowWidth;
  974.     UWORD            ArrowHeight;
  975.  
  976.     UWORD            PickerWidth;
  977.  
  978.     UWORD            PopLeft;
  979.     UWORD            PopWidth;
  980.  
  981.     UWORD            BoxLeft,BoxTop,
  982.                 BoxWidth,BoxHeight;
  983.  
  984.     UWORD            BoxLines;
  985.  
  986.     UWORD            SingleWidth,
  987.                 SingleHeight;
  988.  
  989.     UWORD            AspectX;
  990.     UWORD            AspectY;
  991.  
  992.     UWORD            MenuText,MenuBack;
  993.     UWORD            MenuTextSelect,MenuBackSelect;
  994.  
  995.     UBYTE            Flags;
  996.     BOOLEAN            Blocked;
  997.     BOOLEAN            CentreActive;
  998. } PopInfo;
  999.  
  1000. #define PIA_Labels        (TAG_USER+0x80000)
  1001. #define PIA_Active        (TAG_USER+0x80001)
  1002. #define PIA_Font        (TAG_USER+0x80002)
  1003. #define PIA_Highlight        (TAG_USER+0x80003)
  1004. #define PIA_CentreActive    (TAG_USER+0x80004)
  1005. #define PIA_AspectX        (TAG_USER+0x80005)
  1006. #define PIA_AspectY        (TAG_USER+0x80006)
  1007.  
  1008.  
  1009. /*****************************************************************************/
  1010.  
  1011.  
  1012. typedef struct TabEntry
  1013. {
  1014.     struct BitMap *    BitMap;
  1015.     UWORD        Left;
  1016. } TabEntry;
  1017.  
  1018. typedef struct TabInfo
  1019. {
  1020.     struct BitMap *    BitMap;
  1021.     struct RastPort    RPort;
  1022.     PLANEPTR    Mask;
  1023.  
  1024.     TabEntry *    Tabs;
  1025.     WORD        Count;
  1026.     WORD        Current;
  1027.     WORD        Initial;
  1028.  
  1029.     UWORD        Thick;
  1030.     UWORD        TabWidth;
  1031.     UWORD        TabHeight;
  1032.  
  1033.     WORD        Offset;
  1034. } TabInfo;
  1035.  
  1036. #define TIA_Labels    (TAG_USER+0x90000)
  1037. #define TIA_Font    (TAG_USER+0x90001)
  1038. #define TIA_Screen    (TAG_USER+0x90002)
  1039. #define TIA_Index    (TAG_USER+0x90003)
  1040. #define TIA_DrawInfo    (TAG_USER+0x90004)
  1041. #define TIA_SizeType    (TAG_USER+0x90005)
  1042.  
  1043.  
  1044. /*****************************************************************************/
  1045.  
  1046.  
  1047. struct CheckGlyph
  1048. {
  1049.     UWORD        Width,
  1050.             Height;
  1051.     struct BitMap *    Plain;
  1052.     struct BitMap *    Selected;
  1053. };
  1054.  
  1055.  
  1056. /*****************************************************************************/
  1057.  
  1058. /* These may not be defined in the default header files. */
  1059.  
  1060. #ifndef GDOMAIN_MINIMUM
  1061. #define    GDOMAIN_MINIMUM (0)    /* Minimum size */
  1062. #endif    /* GDOMAIN_MINIMUM */
  1063.  
  1064. #ifndef GDOMAIN_NOMINAL
  1065. #define    GDOMAIN_NOMINAL    (1)    /* Nominal size */
  1066. #endif    /* GDOMAIN_NOMINAL */
  1067.  
  1068. #ifndef GDOMAIN_MAXIMUM
  1069. #define    GDOMAIN_MAXIMUM    (2)    /* Maximum size */
  1070. #endif    /* GDOMAIN_MAXIMUM */
  1071.  
  1072.  
  1073. /*****************************************************************************/
  1074.  
  1075.  
  1076. #endif
  1077.